//index.js
//获取应用实例
const app = getApp()

Page({
  data: {
    titles: [{
      id: 1,
      name: "动作片"
    }, {
      id: 2,
      name: "科幻片"
    }, {
      id: 3,
      name: "喜剧片"
    }],
    list: [],
    list1: [{
      id: 1,
      name: "碟中谍6：全面瓦解",
      pubTime: "2018-08-31"
    }, {
      id: 2,
      name: "海王 Aquaman",
      pubTime: "2018-12-07"
    }, {
      id: 3,
      name: "邪不压正 (2018)",
      pubTime: "2018-07-13"
    }, {
      id: 4,
      name: "叶问4：完结篇",
      pubTime: "2019-12-20"
    }, {
      id: 5,
      name: "双子杀手 Gemini Man",
      pubTime: "2019-10-18"
    }, {
      id: 6,
      name: "恶人传 악인전",
      pubTime: "2019-05-15"
    }, {
      id: 7,
      name: "速度与激情：特别行动",
      pubTime: "2019-08-23"
    }, ],
    list2: [{
      id: 1,
      name: "流浪地球 (2019)",
      pubTime: "2019-02-05"
    }, {
      id: 2,
      name: "复仇者联盟4：终局之战",
      pubTime: "2019-04-24"
    }, {
      id: 3,
      name: "毒液：致命守护者",
      pubTime: "2018-11-09"
    }, {
      id: 4,
      name: "阿丽塔：战斗天使",
      pubTime: "2019-02-05"
    }, {
      id: 5,
      name: "蜘蛛侠：英雄远征",
      pubTime: " 2019-06-28"
    }],
    list3: [{
      id: 1,
      name: "起跑线2 Angrezi Medium",
      pubTime: "2020-03-13"
    }, {
      id: 2,
      name: "西虹市首富",
      pubTime: "2018-07-27"
    }, {
      id: 3,
      name: "绿皮书 Green Book",
      pubTime: "2019-03-01"
    }, {
      id: 4,
      name: "飞驰人生",
      pubTime: "2019-02-05"
    }, {
      id: 5,
      name: "无名之辈 ",
      pubTime: " 2018-11-16"
    }]
  },
  onLoad: function () {
    this.setData({
      list: this.data.list1
    });
  },
  tapTitle: function (e) {
    if (e.target.dataset.id == 1) {
      this.setData({
        list: this.data.list1
      });
    } else if (e.target.dataset.id == 2) {
      this.setData({
        list: this.data.list2
      });
    } else if (e.target.dataset.id == 3) {
      this.setData({
        list: this.data.list3
      });
    }
  }
})